package com.sudo.rpc.api.utils;

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class RegistryUtil {
    public static void startRegistry(int port){
        try {
            LocateRegistry.createRegistry(port);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    public static Registry getRegistry(Integer registryPort){
        try {
            return LocateRegistry.getRegistry(registryPort);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return null;
    }
}
